From: Matthias Clasen Date: Fri, 19 Jan 2018 00:48:12 +0000 (-0500) Subject: font chooser dialog: Improve sensitivity handling X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~38^2~54 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=5f675181ceec8cc73a48b8caca44d1218194cdc4;p=gtk%2B3.0.git font chooser dialog: Improve sensitivity handling Enable the select button when a font is selected, as it should be. --- diff --git a/gtk/gtkfontchooserdialog.c b/gtk/gtkfontchooserdialog.c index ac11ba9284..4805ad374e 100644 --- a/gtk/gtkfontchooserdialog.c +++ b/gtk/gtkfontchooserdialog.c @@ -159,6 +159,20 @@ gtk_font_chooser_dialog_class_init (GtkFontChooserDialogClass *klass) gtk_widget_class_bind_template_callback (widget_class, font_activated_cb); } +static void +update_button (GtkFontChooserDialog *dialog) +{ + GtkFontChooserDialogPrivate *priv = dialog->priv; + PangoFontDescription *desc; + + desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (priv->fontchooser)); + + gtk_widget_set_sensitive (priv->select_button, desc != NULL); + + if (desc) + pango_font_description_free (desc); +} + static void gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag) { @@ -182,6 +196,10 @@ G_GNUC_END_IGNORE_DEPRECATIONS _gtk_font_chooser_set_delegate (GTK_FONT_CHOOSER (fontchooserdiag), GTK_FONT_CHOOSER (priv->fontchooser)); + + g_signal_connect_swapped (priv->fontchooser, "notify::font-desc", + G_CALLBACK (update_button), fontchooserdiag); + update_button (fontchooserdiag); } /**